/*
 * @author: yejiang1015
 * @Date: 2019-03-02 00:19:44
 * @Last Modified by: yejiang1015
 * @Last Modified time: 2019-03-31 23:11:35
 */
import React, {Component} from 'react';
import {hot} from 'react-hot-loader/root';
import {routerRedux} from 'dva/router';
import {Tabs} from 'antd';
import {connect} from 'dva';
import RouteView from '@/components/RouteView';
const TabPane = Tabs.TabPane;

@connect(({global, dashboard}) => ({
    global,
    dashboard
}))
class RouteDataView extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    changeTabgs = val => {
        const {dispatch} = this.props;
        dispatch(routerRedux.push(val));
    };
    render() {
        const {match} = this.props;
        return (
            <section className="bg-fff ui-p-15">
                <Tabs activeKey={this.props.location.pathname} onChange={this.changeTabgs}>
                    <TabPane tab="趋势" key={`${match.path}/trends`} />
                    <TabPane tab="表格" key={`${match.path}/tables`} />
                    <TabPane tab="表单" key={`${match.path}/forms`} />
                </Tabs>
                <RouteView routesKey={match.path} />
            </section>
        );
    }
}

export default hot(RouteDataView);
